package com.romotc.qqrobot.webqq.qqInterfaceCall;

import java.util.ArrayList;

import org.json.JSONException;
import org.json.JSONObject;

import com.romotc.qqrobot.bean.QQLogedin;
import com.romotc.scache.httpreq;

/**
 * 根据Tuin获取好友QQ号码
 * @author Administrator
 *返回信息：：{"retcode":0,"result":{"uiuin":"","account":819512594,"uin":1924492178}}
 *其中account 是QQ号码
 */
public class Get_friend_uin2_GetQQNumFromTuin_InterCall extends QQInterfaceCall {

	public static final String Key_Must_Input_Tuin = "Get_friend_uin2_Tuin";
	@Override
	public String buildReqBody(JSONObject reqDataObj, QQLogedin loginQQ)
			throws Exception {
		return null;
	}

	@Override
	public int getLogLevel() {
		return 1001;
	}

	@Override
	public String getReqUrl(JSONObject reqDataObj, QQLogedin loginQQ)
			throws JSONException {
		// http://s.web2.qq.com/api/get_friend_uin2?tuin=1924492178&verifysession=&type=1&code=&vfwebqq=3c85a97c5878292736b880b807a61468f59b39ddff7763ba91d1381ca0831821f170547562ec1242&t=1326977482624
		return "http://s.web2.qq.com/api/get_friend_uin2?tuin=" 
			+ reqDataObj.getString(Key_Must_Input_Tuin)
			+ "&verifysession=&type=1&code=&vfwebqq=" + loginQQ.getVfwebqq();
	}

	@Override
	public int getReq_method() {
		return httpreq.REQUEST_GET;
	}

	@Override
	public boolean hasPreCall(QQLogedin loginQQ, JSONObject reqDataObj) {
		return false;
	}

	@Override
	public ArrayList<String> myReqHeaders(int reqBodyLen, QQLogedin loginQQ,JSONObject reqDataObj) {
		ArrayList<String> s = buildReqHeaders(loginQQ,
				"http://s.web2.qq.com/proxy.html?v=20110412001&callback=1&id=2", 
				"s.web2.qq.com");
		return s;
	}

	@Override
	public JSONObject preCall(QQLogedin loginQQ, JSONObject reqDataObj)
			throws Exception {
		return null;
	}
	
	private static Get_friend_uin2_GetQQNumFromTuin_InterCall instance;
	public static synchronized Get_friend_uin2_GetQQNumFromTuin_InterCall getInstance() {
		if(instance == null)
			instance = new Get_friend_uin2_GetQQNumFromTuin_InterCall();
		
		return instance;
	}

}
